package edu.hwadee.BEIS.entity;

import com.alibaba.fastjson.JSON;

import edu.hwadee.BEIS.constants.ResultEnum;

/**
 * 响应返回结果类 JSON格式
 * 
 * @author kingsong
 *
 */
public class JsonResult {

	/** 错误码. */
	private Integer code;

	/** 提示信息. */
	private String msg;

	/** 具体的内容. */
	private Object data;

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = JSON.toJSON(data);
	}

	public void reset(ResultEnum re) {
		this.code = re.getCode();
		this.msg = re.getMsg();
	}

	/** 重写toString() */
	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}
}
